<template>
  <footer class="footer">
    <span class="todo-count"><strong>{{total}}</strong> 条</span>
    <ul class="filters" ref="ul">
      <li><a @click="nowSel(1)" :class="{selected:i==1}" href="#/">所有</a></li>
      <li>
        <a @click="nowSel(2)" :class="{selected:i==2}">进行中</a>
      </li>
      <li>
        <a @click="nowSel(3)" :class="{selected:i==3}">完成</a>
      </li>
    </ul>
    <button class="clear-completed" @click="clear">清除完成事项</button>
  </footer>
</template>

<script>
export default {
  // 定义属性
  data() {
    return {
      i: 1
    }
  },
  // 方法集合
  methods: {
    clear() {
      this.$emit('clear')
    },
    nowSel(i) {
      this.i = i
      this.$emit('screening', i)
    }
  },
  props: {
    total: Number
  }
}
</script>

<style lang='less' scoped>
</style>